Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-media-query-parser

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-media-query-parser

A tool for parsing media query lists.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is postcss-media-query-parser?

The postcss-media-query-parser package is a PostCSS plugin that allows you to parse and manipulate CSS media queries. It provides a way to analyze, modify, and work with media queries in your CSS files programmatically.

What are postcss-media-query-parser's main functionalities?

Parsing Media Queries

This feature allows you to parse a media query string into an object that you can manipulate. The parsed object contains detailed information about the media query, such as its type, expressions, and values.

const parser = require('postcss-media-query-parser');
const mediaQuery = '@media screen and (min-width: 900px)';
const parsed = parser(mediaQuery);
console.log(parsed);

Modifying Media Queries

This feature allows you to modify the parsed media query object and convert it back to a string. In this example, the minimum width is changed from 900px to 800px.

const parser = require('postcss-media-query-parser');
const mediaQuery = '@media screen and (min-width: 900px)';
const parsed = parser(mediaQuery);
parsed.nodes[0].value = '800px';
console.log(parsed.toString());

Analyzing Media Queries

This feature allows you to analyze the parsed media query object to check for specific conditions. In this example, it checks if the media query contains a minimum width of 900px.

const parser = require('postcss-media-query-parser');
const mediaQuery = '@media screen and (min-width: 900px)';
const parsed = parser(mediaQuery);
const isMinWidth900 = parsed.nodes.some(node => node.value === '900px');
console.log(isMinWidth900);

Other packages similar to postcss-media-query-parser

Keywords

FAQs

Package last updated on 13 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc